import { defineMongooseModel } from "#nuxt/mongoose";
export interface DicDataProps {
  name: string;
  code: string;
  list: string;
  createdAt: string;
  updatedAt: string;
}
export const DicSchema = defineMongooseModel<DicDataProps>(
  "Dic",
  {
    list: { type: String },
    name: { type: String },
    code: { type: String, unique: true },
  },
  {
    timestamps: true,
    toJSON: {
      // 过滤掉敏感字段
      transform(doc: any, ret: Record<string, any>, options: any) {
        delete ret.__v;
      },
    },
  }
);
